package com.hgw.Demo11_VisitorPattern.examples;

/**
 * Data time:2021/12/21 20:35
 * StudentID:2019112118
 * Author:hgw
 * Description: 人力资源部类，充当具体访问者类
 */
public class HRDepartment extends Department{
    // 实现人力资源对全职工的访问
    public void visit(FulltimeEmployee employee) {
        int workTime = employee.getWorkTime();
        System.out.println("正式员工" + employee.getName() + "实际工作时间为：" + workTime + "小时.");
        if (workTime > 40) {
            System.out.println("正式员工" + employee.getName() + "加班时间为：" + (workTime-40) + "小时.");
        } else if (workTime < 40) {
            System.out.println("正式员工" + employee.getName() + "请加时间为：" + (40-workTime) + "小时.");
        }

    }

    // 实现人力资源对兼职职工的访问
    public void visit(ParttimeEmployee employee) {
        int workTime = employee.getWorkTime();
        System.out.println("临时工" + employee.getName() + "实际工作时间为：" + workTime + "小时.");
    }
}
